Conversation
There was a problem hiding this comment.
Bug fayl o'zgarishi kerak emas!
| { | ||
| internal class Program | ||
| { | ||
| public delegate bool Predicate1<T>(int t, int max); |
There was a problem hiding this comment.
Predicate1<T> degani bu T toifasi xozircha noma'lum, kelajakda bu delegatdan foydalanilganda, ma'lum qilinadi foydalanuvchini oz'i. Lekin, bu toifa delegat tomondan umuman ishlatilmayapti, bu degani bu generic toifa mutlaqo keraksiz.
| } | ||
| Console.WriteLine(min); | ||
| } | ||
| static void Where(int[] number, Predicate<int> predicate) |
There was a problem hiding this comment.
Where metodini qaytaruv toifasi int massivi bo'lishi kerak. number parametirini nomida "s" xarfi qolib ketgan.
| Console.WriteLine(i); | ||
| } | ||
| } | ||
| static bool NegativeNumbers(int num) |
There was a problem hiding this comment.
bool qaytaradigan metod va o'zgaruvchanlar odatda nomi savol asosida beriladi. Misol uchun: IsNegative -> Manfiymi? IsPositive -> Musbatmi? IsEven -> Juftmi va xokazo... Bu kodni sifatini oshiradi, sababi metod faqat ikta qiymat qaytaradi, metodni chaqirgan odam birdanigi bu metod nima qaytarishi tushuna oladi.
| if (num < 0) | ||
| { | ||
| return true; | ||
| } | ||
| return false; |
There was a problem hiding this comment.
Bug tekshiruvni undan-da osonlashtirsa ham bo'ladi.
| if (num1 < max) | ||
| { | ||
| return true; | ||
| } | ||
| return false; |
There was a problem hiding this comment.
ternary operator ishlatsa bo'ladi.
| if (number < 0) | ||
| { | ||
| return false; | ||
| } | ||
| return true; |
There was a problem hiding this comment.
tekshiruvni qisqartirsa bo'ladi.
| if (min < number) | ||
| { | ||
| return true; | ||
| } | ||
| return false; |
There was a problem hiding this comment.
ternary operator yaxshiroq to'gri keladi.
Mirazyzz
left a comment
There was a problem hiding this comment.
Kodni sifati umuman olganda yomon emas, ammo kichik kamchiliklar bilan.
No description provided.